#include "MyClass.hh"
#include "ClassMate.hh"

int main(){
  std::vector<ClassMate>  myMates;

  std::vector<std::string>  myMatesName{"ZikunZhang","XiaochongJin","LuweioYong","TaijiFang","ZiyanGuo"};
  std::vector<uint64_t>  myMatesID{1111, 2222, 333, 444, 555};
  int classSize = myMatesID.size();

  for(int i =0; i<classSize; i++){
    ClassMate mateTemp(myMatesName[i], myMatesID[i], false);
    myMates.push_back(mateTemp);
  }

  //size = 10, i=0, ...., 9
  for(int i=1; i<classSize-1; i++){
    myMates[i].m_nextClassMate=&(myMates[i+1]);
    myMates[i].m_previousClassMate=&(myMates[i-1]);
  }
  myMates[0].m_nextClassMate=&(myMates[1]);
  myMates[classSize-1].m_previousClassMate=&(myMates[classSize-2]);
  //myMates.front().m_nextClassMate=&(myMates[1]);
  //myMates.back().m_previousClassMate=&(myMates[classSize-2]);
  
  for(int i=0;i<classSize; ++i){
      myMates[i].printInfo();
      //std::cout<<myMates[i] << std::endl; 
  } 

  //myMates[6].printInfo();
  //myMates.at(6).printInfo();
  
  ClassMate newMate("HanyuJiang", 777, 0);
  newMate.m_previousClassMate = &(myMates.back());   
  myMates.back().m_nextClassMate = &newMate;  
 
  myMates.push_back(newMate);
  classSize = myMates.size();

  std::cout<<"After adding new class mate" << std::endl;
  for(int i=0;i<classSize; ++i){
      myMates[i].printInfo();
  } 

  std::cout<<"Prepared to print the list "<< std::endl; 
// Construct a list
  MyClass myClass(myMates[0],myMates[1]);
  myClass.insert(0,newMate); 
  myClass.printList();

  // 1. create Mate[A E]
  // 2. link Mate into list:  MateA -> MateB -> MateC-> MateD-> MateE->end/null 
  // 3. print info from all mate[A E] in the order of list
   
  
  // std::cout<<"name "<< mateA.m_name
  // 	   <<"id "<< mateA.m_id
  // 	   <<"isGirl" << mateA.m_isGirl
  // 	   <<std::endl;
  return 0;
}
